package org.ne.banksys.mapper;

import org.apache.ibatis.annotations.*;
import org.ne.banksys.entity.Deposit;

import java.util.List;

/**
 * @author wey
 * @date 2025/6/13 下午10:41 06
 **/

@Mapper

public interface DepositMapper {
    @Select("select saving_id from deposit where saving_name=#{savingName}")
    Long getSavingId(String savingName);

    @Select("select saving_name from deposit where saving_id=#{savingId}")
    String getSavingNameById(Long savingId);

    @Select("select * from deposit where saving_name=#{savingName}")
    Deposit getSavingByName(String savingName);

    @Insert("insert into deposit(saving_name, descrip)" +
            "values (#{savingName}, #{descrip})")
    void insert(Deposit deposit);


    @Update("UPDATE deposit set saving_name=#{savingName}, descrip=#{descrip} where saving_id=#{savingId}")
    void update(Deposit deposit);

    @Delete("delete from deposit where saving_id=#{savingId} ")
    void delete(Long savingId);

    @Select("select * from deposit ")
    List<Deposit> getAll();

}
